// 通用表单样式
.form-container {
  width: 100%;
  padding: $spacing-base;
  
  // 表单布局变体
  &.form-inline {
    .el-form {
      display: flex;
      flex-wrap: wrap;
      gap: $spacing-base;
      max-width: none;
      
      .el-form-item {
        margin-bottom: 0;
        flex: 1 1 auto;
      }
    }
  }
  
  &.form-grid {
    .el-form {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
      gap: $spacing-lg;
      max-width: none;
    }
  }
  
  &.form-compact {
    .el-form-item {
      margin-bottom: $spacing-sm;
    }
  }
  
  .el-form {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    transition: all $animation-duration-base $animation-timing-function-ease;
    
    &.is-loading {
      opacity: 0.7;
      pointer-events: none;
    }
  }
  
  .el-input {
    --el-input-height: 40px;
    
    .el-input__wrapper {
      background-color: var(--el-fill-color-blank);
      box-shadow: 0 0 0 1px var(--el-border-color);
      transition: all $animation-duration-base $animation-timing-function-ease;
      
      &:hover {
        box-shadow: 0 0 0 1px var(--el-color-primary-light-3);
      }
      
      &.is-focus {
        box-shadow: 0 0 0 1px var(--el-color-primary);
        transform: translateY(-1px);
      }
    }
    
    .el-input__inner {
      transition: all $animation-duration-base $animation-timing-function-ease;
      
      &::placeholder {
        color: var(--el-text-color-placeholder);
        transition: color $animation-duration-base $animation-timing-function-ease;
      }
      
      &:focus::placeholder {
        color: var(--el-text-color-secondary);
      }
    }
    
    // 验证状态
    &.is-success {
      .el-input__wrapper {
        box-shadow: 0 0 0 1px var(--el-color-success) !important;
      }
    }
    
    &.is-error {
      .el-input__wrapper {
        box-shadow: 0 0 0 1px var(--el-color-danger) !important;
        animation: shake 0.5s $animation-timing-function-ease;
      }
    }
  }
  
  .el-form-item {
    margin-bottom: $spacing-lg;
    transition: all $animation-duration-base $animation-timing-function-ease;
    
    &.is-error {
      .el-form-item__error {
        animation: slideDown 0.3s $animation-timing-function-ease;
      }
    }
    
    .el-form-item__label {
      font-weight: $font-weight-medium;
      color: var(--el-text-color-primary);
      transition: color $animation-duration-base $animation-timing-function-ease;
      
      &::before {
        color: var(--el-color-danger);
      }
    }
    
    .el-form-item__error {
      color: var(--el-color-danger);
      font-size: $font-size-small;
      margin-top: $spacing-mini;
      transition: all $animation-duration-base $animation-timing-function-ease;
    }
  }
  
  .form-footer {
    text-align: center;
    margin-top: $spacing-lg;
    
    .el-button {
      min-width: 120px;
      transition: all $animation-duration-base $animation-timing-function-bounce;
      
      & + .el-button {
        margin-left: $spacing-base;
      }
      
      &:hover {
        transform: translateY(-2px);
      }
      
      &:active {
        transform: translateY(0);
      }
    }
  }
}

// 全宽按钮
.w-full {
  width: 100% !important;
}

// 表单操作栏
.form-operations {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: $spacing-lg;
  transition: all $animation-duration-base $animation-timing-function-ease;
  
  .operations-left,
  .operations-right {
    display: flex;
    gap: $spacing-sm;
    align-items: center;
  }
}

// 表单标题
.form-title {
  text-align: center;
  margin-bottom: $spacing-xl;
  transition: all $animation-duration-base $animation-timing-function-ease;
  
  h2 {
    margin: $spacing-lg 0 $spacing-xs;
    color: var(--el-text-color-primary);
    font-size: $font-size-huge;
    font-weight: $font-weight-semi-bold;
    transition: all $animation-duration-base $animation-timing-function-ease;
    
    &:hover {
      color: var(--el-color-primary);
    }
  }
  
  p {
    color: var(--el-text-color-secondary);
    font-size: $font-size-base;
    transition: color $animation-duration-base $animation-timing-function-ease;
  }
}

// 动画关键帧
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

// 响应式适配
@include respond-to(xs) {
  .form-container {
    padding: $spacing-sm;
    
    &.form-grid {
      .el-form {
        grid-template-columns: 1fr;
      }
    }
    
    .form-footer {
      .el-button {
        width: 100%;
        
        & + .el-button {
          margin-left: 0;
          margin-top: $spacing-sm;
        }
      }
    }
  }
  
  .form-operations {
    flex-direction: column;
    gap: $spacing-sm;
    
    .operations-left,
    .operations-right {
      width: 100%;
      justify-content: center;
    }
  }
} 